#include "../Graphics/Formulas3D.h"
#include "../Graphics/terrain_Surface.h"
#include "World.h"
#include "Messages.h"
#include "MessageProcessor.h"


World::World()	:
		m_IsQuit(0)
{
    init();
}

World::~World(void)
{
    destroy();
}

void World::init()
{
    m_Surface.Init (3, 3, 3);
}

void World::destroy()
{
    m_Surface.Destroy();
}

void World::HandleMessages()
{
    MessageProcessor &messProc = MessageProcessor::GetInstance();
    WorldMessages &worldMessages = messProc.GetWorldMessages();
    for (WorldMessages::iterator wm = worldMessages.begin(); wm != worldMessages.end(); wm++) {
        handleMessage(*wm);
    }
}

void World::Update()
{

}

void World::Render (Renderer *renderer)
{
    m_Surface.Render (renderer);
}

bool World::IsQuit()
{
	return m_IsQuit;
}

void World::handleMessage(WorldMessage &worldMess)
{
    switch (worldMess.GetType())
    {
        case wmDESELECT_ALL:
            break;
        case wmPOINT_ON_MAP:
            break;
        case wmLIGHT_SURFACE:
            break;
        default:
            break;
    }
}



